require 'sidekiq/web'
Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]

Rails.application.routes.draw do
  root 'sales/firms#index'

  namespace :sales do
    resources :firms
  end
  mount Sidekiq::Web => '/sidekiq'
  require 'admin_constraint'
  mount ExceptionTrack::Engine => '/exceptions', constraints: AdminConstraint.new


  get '/login' => 'sessions#login'
  post '/login' => 'sessions#do_login'

  get '/register' => 'sessions#register'
  post '/register' => 'sessions#do_register'

  get '/forgot' => 'sessions#forgot'
  post '/forgot' => 'sessions#do_forgot'

  delete '/logout' => 'sessions#logout'
  get '/logout' => 'sessions#logout'

  get '/change_locale' => 'sessions#change_locale'

end

handle = Rails.env.production? ? method(:require) : method(:load)
Dir.glob(File.join(Rails.root, 'config', 'routes', '*.rb'), &handle)
